//
//  JSViewController.m
//  MyiOS
//
//  Created by zhuyechao on 18/04/2017.
//  Copyright © 2017 zyc. All rights reserved.
//

#import "JSViewController.h"

@interface JSViewController () <UIWebViewDelegate>

@property (nonatomic, strong)UIWebView *webView;

@end

@implementation JSViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self doInit];

    [self loadLocalHtml];
}

- (void)doInit {
    self.webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:_webView];
}

- (void)loadLocalHtml {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"jscontext" ofType:@"html"];
    NSURL *url = [NSURL fileURLWithPath:path];
    NSLog(@"url: %@", url);
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [_webView loadRequest:request];
}

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType {
    return YES;
}

- (void)webViewDidStartLoad:(UIWebView *)webView {
    //
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
    //
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
    //
}

@end
